#!/usr/bin/env python3

def main():
    s = input("请输入一行字符串: ")
    n = []
    sum = 0

    s += ' '   #作为结尾符判断

    for c in s:
        if '0' <= c <= '9':
            n.append(ord(c) - 48)
        elif n:
            num = 0
            for i in n:
                num = num * 10 + i
            sum += num
            n = []

    print("sum = ", sum)


if __name__ == "__main__":
    main()
